package com.woniuedu.search.direct;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class RabbitMQReturns implements RabbitTemplate.ReturnCallback {

    /**
     * return模式回调函数
     *
     * @param message    消息信息
     * @param replyCode  退回的状态码
     * @param replyText  退回的信息
     * @param exchange   交换机
     * @param routingKey 路由键
     */
    @Override
    public void returnedMessage(Message message, int replyCode, String replyText, String exchange, String routingKey) {
        log.warn("消息路由失败回调...做一些补偿或者记录.............................................");
        log.warn("message{}", message);
        log.warn("replyCode{}", replyCode);
        log.warn("replyText{}", replyText);
        log.warn("exchange{}", exchange);
        log.warn("routingKey{}", routingKey);
    }
}

